import os
import shutil
import sys
import subprocess

ORIGINAL=['asset', 'Compiled.lnk', 'control.py', 'documentation', 'editor_control.py', 'ElivoEditor.pyw', 'img', 'levels', 'main.pyw', 'requirements.txt', 'save', 'setup.py', '__pycache__']
need_on_git=("calca","pygame-crew")
account="https://gitee.com/impodog/%s.git"

print("Checking requirements with pip...")
subprocess.call((sys.executable,'-m','pip','install','-r','requirements.txt'))
print("Site requirements checked.")

print("Checking other requirements...")
try:shutil.rmtree("./repo")
except:...
try:os.mkdir("./repo")
except:...
os.chdir("./repo")
for nog in need_on_git:
    print("Trying to install %s."%nog)
    PATH="./%s/"%nog
    url=account%nog
    subprocess.call(("git","clone",url))
    os.chdir(PATH)
    subprocess.call(("git","pull"))
    subprocess.call((sys.executable,"./setup.py"))
    os.chdir("..")
os.chdir("..")
print("Elivo setup complete!")